package icraf.carbon.model;

import icraf.carbon.core.LandCover;

import java.util.HashMap;

public class TransitionProbabilityMatrix {
	public TransitionProbabilityMatrix() {
		super();
	}

	private HashMap<LandCover, HashMap<LandCover, Double>>  landCoverChangeModif = new HashMap<LandCover, HashMap<LandCover, Double>>();
	
	public double getValue(LandCover lc1, LandCover lc2) {
		HashMap<LandCover, Double> lc1List = landCoverChangeModif.get(lc1);
		if (lc1List == null)
			return 0;
		if (lc1List.get(lc2) == null)
			return 0;
		double d = lc1List.get(lc2);
		return d;
	}
	
	public void setValue(double d, LandCover lc1, LandCover lc2) {
		HashMap<LandCover, Double> lc1List = landCoverChangeModif.get(lc1);
		if (lc1List == null) {
			lc1List = new HashMap<LandCover, Double>();
		}
		lc1List.put(lc2, d);
		landCoverChangeModif.put(lc1, lc1List);
	}
}
